import request from './request.js'
import { Decrypt } from '@/utils/aes.js'

// 添加购物车
export function addShopCar({courseId,memberId,token}){
    return request({
        url:'/api/shopcar/addShopCar',
        method:'POST',
        data:{courseId,memberId},
        headers:{
            // 本地保存的accessToken
            'Authorization': Decrypt(localStorage.getItem('token')),
            'token':token
        }
    })
}

// 获取购物车商品
export function getShopCarList(){
    return request({
        url:'/api/shopcar/getShopCarList',
        method:'GET',
        headers:{
            // 本地保存的accessToken
            'Authorization': Decrypt(localStorage.getItem('token')),
        }
    })
}

// 删除购物车
export function deleteShopCar({id,token}){
    return request({
        url:'/api/shopcar/deleteShopCar',
        method:'GET',
        params:{id},
        headers:{
            // 本地保存的accessToken
            'Authorization': Decrypt(localStorage.getItem('token')),
            'token':token
        }
    })
}